#ifndef AUDIOTHREAD_H
#define AUDIOTHREAD_H
#include <QThread>
#include <QDebug>
#include <QTimer>
#include "bass.h"
#include "bass_fx.h"
#include <QMessageBox>
#include <QDebug>
#include <QVector>

void __stdcall syncFunc(HSYNC handle, DWORD channel, DWORD data, void *user);
class AudioThread : public QObject
{
    Q_OBJECT
public:
    explicit AudioThread(QObject *parent = 0);
    bool playing;
    void addFX(DWORD type, const void* params);
    float v;
    QVector<HFX> list_effects;
private:
    HSTREAM chan;
    HSTREAM exportChan;
    QTimer *t;
signals:
    void endOfPlayback();
    void curPos(double Position, double Total);
    void delTrack(AudioThread* track);
public slots:
    bool play(QString filepath);
    void pause();
    void resume();
    void stop();
    void signalUpdate();
    void changePosition(int position);
    int getLen();
    void check(bool vol);
    void volume(int value);
    void del();
    void leftRight(int value);
    void del_effects();
    void addAttribute(DWORD type, float value);
    HSTREAM getChannel();
};

#endif // AUDIOTHREAD_H

